package com.my.test.goods.service;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.my.test.goods.dao.GoodsMapper;
import com.my.test.goods.entiy.Goods;

@Service
public class GoodsServiceImpl implements GoodsService {

	@Autowired
	private GoodsMapper goodsMapper;
	
	@Override
	public List<Goods> getGoodsByIds(String ids) {
		if(null!=ids){
			return goodsMapper.getGoodsByIds(Arrays.asList(ids.split(",")).stream().filter(k->null!=k&&!"".equals(k)).map(k->Integer.parseInt(k)).collect(Collectors.toList()));
		}
		return null;
	}
	
}
